package com.lotusfall.api;


import com.github.pagehelper.PageInfo;
import com.lotusfall.pojo.User;
import com.lotusfall.service.UserService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

@DubboService(version = "1.0")
public class ApiUserServiceImpl implements ApiUserService {
    @Autowired
    private UserService userService;

    @Override
    public PageInfo<User> queryUserList(Integer page, Integer pageSize) {
        return this.userService.queryUserList(page, pageSize);
    }

    @Override
    public User getCurrentUser() {
        return this.userService.getCurrentUser();
    }

    @Override
    public User selectUserByUsername(String username) {
        return this.userService.selectUserByUsername(username);
    }


    @Override
    public List<User> queryAll() {
        return this.userService.queryAll();
    }

    @Override
    public boolean addUser(User user) {
        int i = this.userService.addUser(user);
        if(i == 1)return true;
        return false;
    }

    @Override
    public boolean setUserAvatar(String username, String url) {
        int i = this.userService.setUserAvatar(username, url);
        if(i == 1)return true;
        return false;
    }

    @Override
    public User getUserById(Long id) {
        return this.userService.getUserById(id);
    }

}
